package cn.csc.module.search.dal.dataobject.sku;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDateTime;

/**
 * @author liuchuang
 * @version 1.0
 * @modify
 * @since 2025/3/17 15:25
 */
@Setter
@Getter
@ToString
@Document(indexName = "sku_index")
public class SkuDO {

    @Id
    private BigInteger id;

    @Field(name = "spu_id", type = FieldType.Long)
    private BigInteger spuId;

    @Field(name = "spu_name", type = FieldType.Keyword)
    private String skuName;

    @Field(type = FieldType.Keyword)
    private String attrs;

    @Field(name = "img_url",type = FieldType.Keyword)
    private String imgUrl;

    /**
     * 售价
     */
    @Field(name = "price_fee", type = FieldType.Scaled_Float)
    private BigDecimal priceFee;

    /**
     * 市场价
     */
    @Field(name = "market_price_fee", type = FieldType.Scaled_Float)
    private BigDecimal marketPriceFee;

    /**
     * 企业购售价
     */
    @Field(name = "shop_price_fee", type = FieldType.Scaled_Float)
    private BigDecimal shopPriceFee;

    /**
     * 企业购市场价
     */
    @Field(name = "shop_market_price_fee", type = FieldType.Scaled_Float)
    private BigDecimal shopMarketPriceFee;

    /**
     * 拿样价格
     */
    @Field(name = "sample_price", type = FieldType.Scaled_Float)
    private BigDecimal samplePrice;
    /**
     * 商品编码
     */
    @Field(name = "party_code", type = FieldType.Keyword)
    private String partyCode;
    /**
     * 商品条形码
     */
    @Field(name = "model_id", type = FieldType.Keyword)
    private String modelId;

    /**
     * 商品重量(kg)
     */
    @Field(name = "weight", type = FieldType.Keyword)
    private BigDecimal weight;

    /**
     * 商品净重(kg)
     */
    @Field(name = "net_weight", type = FieldType.Scaled_Float)
    private BigDecimal netWeight;
    /**
     * 商品体积
     */
    @Field(type = FieldType.Scaled_Float)
    private BigDecimal volume;
    /**
     * 尺寸(长宽高，以*分隔，cm)
     */
    @Field(type = FieldType.Keyword)
    private String dimension;
    /**
     * 状态 1:enable, 0:disable, -1:deleted
     */
    @Field(type = FieldType.Keyword)
    private Integer status;


    @Field(type = FieldType.Keyword)
    private String creator;

    @Field(name = "create_time", type = FieldType.Date, format = DateFormat.custom,
            pattern = "yyyy-MM-dd'T'HH:mm:ssXXX")
    private LocalDateTime createTime;

    @Field(type = FieldType.Keyword)
    private String updater;

    @Field(name = "update_time", type = FieldType.Date, format = DateFormat.date_time_no_millis)
    private LocalDateTime updateTime;

    @Field(name = "tenant_id", type = FieldType.Long)
    private BigInteger tenantId;


}
